import {
  camelCase,
  paramCase,
  pascalCase,
  snakeCase,
  constantCase,
  capitalCase,
  dotCase,
  headerCase,
  noCase,
  pathCase,
} from "change-case";
import { workspace } from "vscode";
const  defaultFormatOrder: string[]	 = ["camelCase", "pascalCase", "snakeCase", "paramCase", "headerCase", "constantCase", "dotCase", "pathCase", "noCase", "capitalCase"];

const translateMap: {[key: string]: any} = {
  camelCase: {
    transformHandler: camelCase,
    description: "小驼峰 (camelCase)",
  },
  pascalCase: {
    transformHandler: pascalCase,
    description: "大驼峰 (pascalCase)",  
  },
  snakeCase: {
    transformHandler: snakeCase,
    description: "下划线链接 (snakeCase)",  
  },
  paramCase: {
    transformHandler: paramCase,
    description: "小中划线链接 (paramCase)",  
  },
  headerCase: {
    transformHandler: headerCase,
    description: "大中划线链接 (headerCase)",
  },
  constantCase: {
    transformHandler: constantCase,
    description: "常量 (constantCase)",
  },
  dotCase: {
    transformHandler: dotCase,
    description: "对象属性 (dotCase)",
  },
  pathCase: {
    transformHandler: pathCase,
    description: "路径 (pathCase)",
  },
  noCase: {
    transformHandler: noCase,
    description: "小分词 (noCase)",
  },
  capitalCase: {
    transformHandler: capitalCase,
    description: "大分词 (capitalCase)",
  },
};
export default function getTransformTypes () {
 let formatOrder:string[]= workspace.getConfiguration("var-translate-en").order;
  // 没有赋予默认值
  if (!formatOrder || formatOrder.length === 0) {
    formatOrder = defaultFormatOrder;
  }
 return formatOrder.map((typeName) => ({
    namingFormat: typeName,
    ...translateMap[typeName],
  }));
};